from model.BaseModel import *

class CodesModel(BaseModel):
    def __init__(self):
        super(CodesModel, self).__init__("stock")

    def updateCodes(self):
        sql = "insert into codes(code) select distinct code from day_kline where code not in (select code from codes);"
        print(sql)
        self.db.update(sql)

    def getStockInfo(self,code):
        sql = "select * from codes where substring(code,3,6)='" + code + "';"
        return self.db.executeSqlMap(sql,"codes")